package com.dean.sql.factory;

import com.dean.sql.DataBaseTypeEnum;
import com.dean.sql.service.DeanSql;
import com.dean.utils.DeanDbUrlUtils;

/**
 * @ClassName DeanAutoSqlFactory
 * @Description
 * @Date 2022/1/1 14:08
 * @Created by dean
 */
public class DeanAutoSqlFactory {
//    private static final String ORALCE = "oracle";
//    private static final String MYSQL = "mysql";
//    private static final String POSTGRESQL = "postgresql";

//    public static DeanSql getDeanSql(SqlDriverEnum driver){
//        return getDeanSql(driver,null);
//    }


    public static DeanSql getDeanSql(String url){
        DeanSqlFactory sqlFactory = null;
        switch (DataBaseTypeEnum.get(url)){
            case ORALCE:
                sqlFactory = new DeanOracleFactory();
                break;
            case MYSQL:
                sqlFactory = new DeanMysqlFactory(url);
                break;
            case POSTGRESQL:
                sqlFactory = new DeanPgsqlFactory();
            case SQLSERVER:
                sqlFactory = new DeanMssqlFactory();
                break;
            case SQLITE:
                sqlFactory = new DeanSqliteFactory();
        }
        return sqlFactory.createDeanSql();
    }
}
